﻿<!DOCTYPE html>
<html ng-app="demoApp" lang="en">
<head>
    <title id='Description'>AngularJS Chart Axis Position Example</title>
    <meta name="description" content="This is an example of AngularJS Chart. Chart's Axis is with changed position." />
	<link rel="stylesheet" type="text/css" href="../../../jqwidgets/styles/jqx.base.css" />
    <script type="text/javascript" src="../../../scripts/angular.min.js"></script> <script type="text/javascript" src="../../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxdraw.js"></script>
    <script type="text/javascript" src="../../../jqwidgets/jqxchart.core.js"></script><script type="text/javascript" src="../../../jqwidgets/jqxangular.js"></script>
    <script type="text/javascript">
        var demoApp = angular.module("demoApp", ["jqwidgets"]);
        demoApp.controller("demoController", function ($scope) {
            // prepare the data
            var source =
            {
                datatype: "tab",
                datafields: [
                    { name: 'Year' },
                    { name: 'HPI' },
                    { name: 'BuildCost' },
                    { name: 'Population' },
                    { name: 'Rate' }
                ],
                url: '../../sampledata/homeprices.txt'
            };

            var dataAdapter = new $.jqx.dataAdapter(source, { async: false, autoBind: true, loadError: function (xhr, status, error) { alert('Error loading "' + source.url + '" : ' + error); } });

            // prepare jqxChart settings
            var settings = {
                title: "U.S. Historical Home Prices (1950-2011)",
                description: "Source: http://www.econ.yale.edu/~shiller/data.htm",
                enableAnimations: true,
                showLegend: true,
                padding: { left: 20, top: 5, right: 20, bottom: 5 },
                titlePadding: { left: 10, top: 0, right: 0, bottom: 10 },
                source: dataAdapter,
                xAxis:
                    {
                        dataField: 'Year',
                        showTickMarks: true,
                        tickMarksInterval: 1,
                        tickMarksColor: '#888888',
                        unitInterval: 5,
                        showGridLines: true,
                        gridLinesInterval: 5,
                        gridLinesColor: '#888888',
                        //axisSize: 'auto',
                        minValue: 1947,
                        maxValue: 2012
                    },
                colorScheme: 'scheme04',
                seriesGroups:
                    [
                        {
                            type: 'line',
                            valueAxis:
                            {
                                unitInterval: 20,
                                maxValue: 400,
                                description: 'U.S. Population (millions)',
                                showGridLines: false
                            },
                            series: [
                                    { dataField: 'Population', displayText: 'Population' }
                                ]
                        },
                        {
                            type: 'spline',
                            valueAxis:
                            {
                                unitInterval: 0.01,
                                maxValue: 0.2,
                                visible: true,
                                displayGridLines: false,
                                position: 'right',
                                description: 'Interest rate'
                        },
                            series: [
                                    { dataField: 'Rate', displayText: 'Interest Rate' }
                                ]
                        },
                        {
                            type: 'spline',
                            valueAxis:
                            {
                                unitInterval: 20,
                                maxValue: 200,
                                position: 'right',
                                description: 'Index Value'
                            },
                            series: [
                                    { dataField: 'HPI', displayText: 'Real Home Price Index' },
                                    { dataField: 'BuildCost', displayText: 'Building Cost Index' }
                                ]
                        }
                    ]
            };


            $scope.chartSettings = settings;
        });
    </script>
</head>
<body ng-controller="demoController">
    <jqx-chart id='chartContainer' jqx-settings="chartSettings" style="width: 850px; height: 500px"></jqx-chart>
</body>
</html>
